package com.coder.config;

import com.coder.utils.result.Res;
import com.coder.utils.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class)
    public Result globalExceptionHandler(Exception e){
        log.error("{}", e.getMessage());
        e.printStackTrace();
        return Res.error("服务器异常");
    }
}
